package cn.mdmbct.spring.starter.douyin.common.properties.dy;

import cn.mdmbct.douyin.common.enums.ApiPlatform;
import cn.mdmbct.spring.starter.douyin.common.annotation.NotNull;
import lombok.Data;
import lombok.Getter;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

/**
 * 抖音应用配置
 *
 * @author mdmbct  mdmbct@outlook.com
 * @date 2021/3/19 20:31
 * @modified mdmbct
 * @since 1.0
 */
@Getter
public class AppProperties implements Serializable {


    private static final long serialVersionUID = -7169726398816840049L;

    @NotNull
    private String key;

    @NotNull
    private String secret;

    /**
     * 回调地址
     */
    private String redirectUrl;

    /**
     * 默认开发平台地址 默认
     * <a href="https://open.douyin.com">https://open.douyin.com</a>
     */
    @NotNull
    private String openUrl = "https://open.douyin.com";

    /**
     * 按照抖音、西瓜、头条的顺序赋值  否则会出现取值错位的问题
     */
    @NotNull
    private List<String> authApisPrefix =
            Arrays.asList(ApiPlatform.DOU_YIN.getPrefix(),
                    ApiPlatform.XI_GUA.getPrefix(),
                    ApiPlatform.SNS.getPrefix());

    public void setKey(String key) {
        this.key = key;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public void setRedirectUrl(String redirectUrl) {
        this.redirectUrl = redirectUrl;
    }

    public void setOpenUrl(String openUrl) {
        this.openUrl = openUrl;
    }

    public void setAuthApisPrefix(List<String> authApisPrefix) {
        this.authApisPrefix = authApisPrefix;
    }
}
